from PIL import Image
import numpy as np


def to_pil(image):
    if isinstance(image, str):
        image = Image.open(image)
        image = image.convert('RGB')
    elif isinstance(image, np.ndarray):
        image = Image.fromarray(image)
        image = image.convert('RGB')
    else:
        raise ValueError("data type not supported")
    return image
